import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AppComponent } from '../app.component';
// default layout
import { DefaultComponent } from '../layout/default/default.component';
import { LayoutModule } from '../layout/layout.module';
import { Exception404Component } from './exception/404.component';


const routes: Routes = [
  {
    path: '',
    component: DefaultComponent,
    // canActivate: [SimpleGuard],
    // canActivateChild: [SimpleGuard],
    children: [
      // list
      // { path: 'exception', loadChildren: () => import('./exception/exception.module').then(m => m.ExceptionModule)},
      // Exception
      // { path: 'exception', loadChildren: './exception/exception.module#ExceptionModule' }, 这种字符串的写法已经会报错了，下面这种写法不会报错
      // { path: 'expection', children: [{path:'404', component: Exception404Component}]}, // 这样是ok的
      { path: 'exception', loadChildren: () => import('./exception/exception.module').then(m => m.ExceptionModule)}
    ],
  },
  {path: '**', redirectTo: 'exception/404'}
];

@NgModule({
  imports: [
    RouterModule.forRoot(routes, {
      useHash: true,
      // NOTICE: If you use `reuse-tab` component and turn on keepingScroll you can set to `disabled`
      // Pls refer to https://ng-alain.com/components/reuse-tab
      scrollPositionRestoration: 'top',
    })],
  exports: [RouterModule]
})
export class RoutesRoutingModule { }
